package cn.itsource.controller.app;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.itsource.pojo.domain.Driver;
import cn.itsource.pojo.dto.WeChatRegisterDto;
import cn.itsource.result.R;
import cn.itsource.service.IDriverService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Tag(name = "小程序-司机对象",description = "小程序-司机对象")
@RestController
@RequestMapping("/app/driver")
public class AppDriverController {

    @Autowired
    public IDriverService driverService;

    /**
     *
     * pojo:所有具有字段,并且具有getter,setter方法的对象我们都叫pojo
     * 1.domain:可以有数据库不存在的字段
     * 2.empty:必须跟数据库字段一一对应
     * 3.dto:后端用于接收前端的参数的对象
     * 4.vo:后端响应给前端用于战术数据的对象
     * 5.bo:带Java代码之间传输参数的对象
     */
    @SaIgnore //忽略拦截
    @Operation( summary= "微信注册",description = "微信注册接口")
    //对接口参数的描述
    @Parameter(name = "WeChatRegisterDto",description = "注册数据对象",required = true)
    @PostMapping("/wechatRegister")
    public R wechatRegister(@RequestBody @Valid WeChatRegisterDto weChatRegisterDto){
        driverService.wechatRegister(weChatRegisterDto);
        return R.success();
    }



}
